package com.clw.classfile;

import com.clw.classfile.attribute.Attribute;
import com.clw.classfile.attribute.info.AttributeInfo;
import com.clw.classfile.constantpool.ConstantPool;

/**
 * Created by chengliwei on 2018/12/24.
 */
public class MemberInfo {

    protected short accessFlags;
    protected short nameIndex;
    protected short descriptorIndex;
    protected short attributesCount;
    protected AttributeInfo[] attributes;

    public MemberInfo(BytesReader reader, ConstantPool constantPool) {
        this.accessFlags = reader.readShort();
        this.nameIndex = reader.readShort();
        this.descriptorIndex = reader.readShort();
        this.attributesCount = reader.readShort();
        this.attributes = new AttributeInfo[this.attributesCount];
        for (int i = 0; i < attributesCount; i++) {
            attributes[i] = Attribute.readAttribute(reader, constantPool);
        }
    }
}
